package cn.whx.hrm.controller;

import cn.whx.hrm.dto.SmsDto;
import cn.whx.hrm.service.IVerifyCodeService;
import cn.whx.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.io.IOException;

@RestController
@RequestMapping("/verifycode")
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService codeService;
    @GetMapping("/imageCode/{key}")
    public AjaxResult imageCode(@PathVariable("key") String key) throws IOException {
        return codeService.imageCode(key);
    }
    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody @Valid SmsDto smsDto){
        return  codeService.sendSmsCode(smsDto);
    }
}
